﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TarreOA.TarreOABLL;
using TarreOA.TarreOAModels;

public partial class Flow_Info_WorkConsign : System.Web.UI.Page {
    private int flow_step_id;
    private int new_work_id;
    private int work_step_sort;
    public Flow_NewFlowStep fnfs;
    public User curLoginUser;

    protected void Page_Load(object sender, EventArgs e) {
        if(!Page.IsPostBack) {
            if(Request.QueryString.Get("FS_ID") != null && Request.QueryString.Get("NW_ID") != null && Request.QueryString.Get("WS_ID") != null) {
                flow_step_id = int.Parse(Request.QueryString.Get("FS_ID"));
                new_work_id = int.Parse(Request.QueryString.Get("NW_ID"));
                work_step_sort = int.Parse(Request.QueryString.Get("WS_ID"));
                curLoginUser = (User) Session["user"];
                Flow_NewFlowStep_Service fnfs_service = new Flow_NewFlowStep_Service();
                fnfs = fnfs_service.FindCurrentStepInfoForConsign(flow_step_id);
                ViewState["flow_step_id"] = flow_step_id;
                ViewState["new_work_id"] = new_work_id;
                ViewState["work_step_sort"] = work_step_sort;
            }
        }
    }
    protected void BtnSubmit_Click(object sender, EventArgs e) {
        if(ViewState["new_work_id"] != null && ViewState["work_step_sort"] != null) {
            new_work_id = (int) ViewState["new_work_id"];
            work_step_sort = (int) ViewState["work_step_sort"];
            string zhuban = Request.Form.Get("zhuban");
            Flow_WorkProcess_Service fwp_service = new Flow_WorkProcess_Service();
            if(fwp_service.ConsignOther(new_work_id, work_step_sort, zhuban) == 1) {
                Response.Redirect("WillTransactWork.aspx");
            }
        }
    }
    protected void BtnBack_Click(object sender, EventArgs e) {
        Response.Redirect("WillTransactWork.aspx");
    }
}
